<?php
/**
 * 视频模型类
 * 
 * 
 */
  import("@.ORG.Page"); //导入分页类
class VideoModel extends Model{
   public function  index(){
    
    
    
   }
   public function getVideoList($uid){
    //处理where条件
    
  //  $limit = isset( $limit )?$limit:$this->config->limitpage;
  //  $result = $this->where( $map )->field( $field )->order( $order )->find() ;
 	    $count=$this->where('uid='.$uid)->count();
   	    
		$p = new Page ( $count, 8);
        
		$list=$this->where('uid='.$uid)->limit($p->firstRow.','.$p->listRows)->order('ctime desc')->findAll();
		$p->setConfig('header','条记录');
		$p->setConfig('prev',"<");
		$p->setConfig('next','>');
		$p->setConfig('first','<<');
		$p->setConfig('last','>>');
        $page = $p->show();
	//	$this->assign ( "page", $page );
	//	$this->assign ( "list", $list );
    $result['page']=$page;
    $result['list']=$list;
    return $result;
   }
   
   /**
    * 
    * 
    * 
    */
    
     public function getVideoInfo($map = null){
    //处理where条件
    $map = $this->merge( $map );
  //  $limit = isset( $limit )?$limit:$this->config->limitpage;
    $result = $this->where( $map )->field( $field )->order( $order )->find() ;
   	return $result;
   } 
    
    
/**
 ** merge 
  * 合并条件
  * @param mixed $map 
  * @access private
  * @return void
  */
   protected function merge ( $map = null ){
            if( isset( $map ) ){
                $map = array_merge( $this->data,$map );
            }else{
                $map = $this->data;
            }

            return $map;
        }
}


?>